<template>
	<view class="subway">
		<text>位置：北京建国门站</text>
		<view class="s2">
			<u-icon name="list" size="30" @click="tomap"></u-icon>
		</view>
		<view class="s1" v-for="item in list" :key="item.lineId" @click="todetail(item.lineId,item.lineName)">
			<text>{{item.lineName}}</text>
			<text>下一站：{{item.nextStep.name}}</text>
			<text>到达本站时长：{{item.reachTime}}分钟</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			getlist(){
				this.api.get('/prod-api/api/metro/list?currentName=建国门').then(res=>{
					this.list=res.data.data
					// console.log(this.list)
					console.log(this.list[0].nextStep.name)
				})
			},
			tomap(){
				uni.navigateTo({
					url:'/pages/serve/subway/allmap/allmap'
				})
			},
			todetail(id,name){
				uni.navigateTo({
					url:'/pages/serve/subway/subwayDetail/subwayDetail?id='+id+'&name='+name
				})
			}
		}
	}
</script>

<style lang="scss">
.s1{
	width: 275px;
	margin: 20px auto;
	display: flex;
	flex-direction: column;
	border: 2px solid #ccc; 
	text-align: center;
	line-height: 35px;
}
.s2{
	float: right;
}
</style>
